package com.imooc.miaosha.redis;

/**
 * @author simple
 * @version 1.0
 * @date 2018/6/14 17:44
 */
public abstract class BaseKeyPrefix implements KeyPrefix {

    private int expiresSec;
    private String prefix;

    public BaseKeyPrefix(String prefix) {
        this(0, prefix);
    }

    public BaseKeyPrefix(int expiresSec, String prefix) {
        this.expiresSec = expiresSec;
        this.prefix = prefix;
    }

    @Override
    public int expiresSec() {
        // 0 代表永不过期
        return expiresSec;
    }

    @Override
    public String getPrefix() {
        return prefix;
    }
}
